package gui.engraving;


import java.awt.ComponentOrientation;
import java.util.ArrayList;

import javax.swing.ImageIcon;
import javax.swing.JTabbedPane;

import clients.RPCClient;

import javax.swing.border.TitledBorder;

import java.awt.Color;
import java.awt.GradientPaint;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.SystemColor;

/**
 * @author Idan
 * This is the GUI tabbed panel
 */
public class EngravingPanel extends JTabbedPane 
{
	public EngravingFrame myEngravingFrame;
	public EngravingReportPanel createReport;
	public EngravingSeperatePanel seperatePanel;
	public EngravingListOfReports listOfReportsPanel;
	public EngravingListOfOrders listOfOrdersPanel;
	public EngravingHistoryOfReports historyOfReportsPanel;
	public RPCClient engravingClient;
	
	public EngravingPanel(EngravingFrame engravingFrame, RPCClient engravingClient)
	{
		setBackground(new Color(173, 216, 230));
		setBorder(new TitledBorder(null, "\u05D9\u05D9\u05E6\u05D5\u05E8", TitledBorder.CENTER, TitledBorder.TOP, null, new Color(59, 59, 59)));
		this.engravingClient = engravingClient;
		this.myEngravingFrame=engravingFrame;
		this.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
		this.setTabPlacement(TOP);
		
		EngravingReportPanel report = new EngravingReportPanel(this);
		EngravingSeperatePanel seperate = new EngravingSeperatePanel(this);
		EngravingListOfReports listOfReports = new EngravingListOfReports(this);
		EngravingListOfOrders listOfOrders = new EngravingListOfOrders(this);
		EngravingHistoryOfReports history = new EngravingHistoryOfReports(this);
		
	
		this.createReport=report;
		this.seperatePanel=seperate;
		this.listOfReportsPanel = listOfReports;
		this.listOfOrdersPanel = listOfOrders;
		this.historyOfReportsPanel = history;

		
		ImageIcon listOfOrdersIcon = new ImageIcon(EngravingFrame.class.getResource("/graphics/listoforders.png"));
		ImageIcon reportIcon = new ImageIcon(EngravingFrame.class.getResource("/graphics/createReport.png"));
		ImageIcon seperateIcon = new ImageIcon(EngravingFrame.class.getResource("/graphics/seperate.png"));
		ImageIcon listOfReportsIcon = new ImageIcon(EngravingFrame.class.getResource("/graphics/listofreports.png"));
		ImageIcon historyIcon = new ImageIcon(EngravingFrame.class.getResource("/graphics/schedule.png"));
		
		this.addTab("רשימת פק''עות לייצור",listOfOrdersIcon,listOfOrders);
		this.addTab("דוח יצור", reportIcon, report);
		this.addTab("רשימת פק''עות להפרדה", listOfReportsIcon, listOfReports);
		this.addTab("דוח הפרדה", seperateIcon, seperate);
		this.addTab("היסטוריית דיווחים", historyIcon, history);
		

	}

	/**
	 * initializes all GUIs
	 */
	public void setVariables(ArrayList<Object> response)
	{
		if (response.get(0).toString().equalsIgnoreCase("initializeAllFieldsEngraving"))
		{
			createReport.setVariables(response);
			seperatePanel.setVariables(response);
			listOfReportsPanel.setVariables(response);
			listOfOrdersPanel.setVariables(response);
			historyOfReportsPanel.setVariables(response);
		}
		
	}
	
	public EngravingReportPanel getPanel()
	{
		return this.createReport;
	}
	
	

}
